package infos

import (
	"github.com/gin-gonic/gin"
	"gogs.xiaoyuanjijiehao.com/antlinker/antcms/app/ginsrv/oplog"
	"gogs.xiaoyuanjijiehao.com/antlinker/antcms/core"
)

// Init 初始化
func Init(route *gin.RouterGroup, d core.CmsDomain) {
	info := createInfoCtrl(d)
	route.GET("", oplog.OplogRoute("cms/infos/list", "获取信息列表", info.getInfoPageList))
	route.POST("", oplog.OplogRoute("cms/infos/add", "新增信息", info.add))
	route.DELETE(":infoid", oplog.OplogRoute("cms/infos/delete", "删除信息", info.delete))
	route.DELETE(":infoid/destroy", oplog.OplogRoute("cms/infos/destroy", "彻底删除信息", info.destroy))
	route.PUT(":infoid/recover", oplog.OplogRoute("cms/infos/recover", "恢复删除信息", info.recover))
	route.PUT(":infoid/desc", oplog.OplogRoute("cms/infos/update/desc", "修改信息描述", info.updateDesc))
	route.GET(":infoid", oplog.OplogRoute("cms/infos/getone", "获取指定信息", info.getInfo))
	route.PUT(":infoid/commit", oplog.OplogRoute("cms/infos/commit", "提交审核", info.commit))
	route.PUT(":infoid/publish", oplog.OplogRoute("cms/infos/publish", "发布信息", info.publish))
	route.PUT(":infoid/unpublish", oplog.OplogRoute("cms/infos/unpublish", "取消发布", info.unpublish))
	route.PUT(":infoid/prohibit", oplog.OplogRoute("cms/infos/prohibit", "禁止发布", info.prohibit))
	route.PUT(":infoid/cancelprohibit", oplog.OplogRoute("cms/infos/cancelprohibit", "取消禁止发布", info.cancelprohibit))
	route.GET(":infoid/oplog", info.queryOplog)
	// cr.GET(":columnid/children", oplog.OplogRoute("cms/column/children", "获取栏目的子栏目", column.getColumnChildren))
	// cr.GET(":columnid/desc", oplog.OplogRoute("cms/column/desc", "获取栏目的描述信息", column.getColumnDesc))
	// cr.PUT(":columnid/ctrl", oplog.OplogRoute("cms/column/update/ctrl", "修改栏目控制参数", column.updateCtrl))
	// cr.GET(":columnid/ctrl", oplog.OplogRoute("cms/column/ctrl", "获取栏目的控制参数信息", column.getColumnCtrl))
	// cr.GET(":columnid/extra", oplog.OplogRoute("cms/column/extra", "获取栏目的扩展属性信息", column.getColumnExtra))
	// cr.PUT(":columnid/extra", oplog.OplogRoute("cms/column/update/extra", "修改栏目扩展属性", column.updateExtra))
	// cr.DELETE(":columnid/destroy", oplog.OplogRoute("column/delete", "彻底删除栏目", column.destroy))
	// // 栏目相关路由
	// route.GET("columntrees/sys", oplog.OplogRoute("cms/columntrees/sys", "获取系统栏目树", column.getColumnTreeForSys))
	// route.GET("columntrees/org/:org", oplog.OplogRoute("cms/columntrees/org", "获取指定组织的栏目树", column.getColumnTreeForOrg))
	// route.GET("columntrees/owner/:owner", oplog.OplogRoute("cms/columntrees/owner", "获取指定用户的栏目树", column.getColumnTreeForOwner))
	// route.GET("columntrees/self", oplog.OplogRoute("cms/columntrees/self", "获取当前用户的栏目树", column.getColumnTreeForSelf))
	// route.GET("extratypes", oplog.OplogRoute("cms/extratypes", "获取栏目可以支持的所有扩展类型", column.getExtraTypeAll))
	// route.GET("extratype/:code", oplog.OplogRoute("cms/extratypes", "获取指定的扩展类型", column.getExtraTypeOne))
}
